<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>系统首页</title>
    <link rel="stylesheet" href="{$CSS}/bootstrap3.3.7.min.css">
    <style>
        td,th{
			text-align: center;vertical-align: middle !important;
			}
        .paging{
           list-style:none;
           display:inline ;
           padding-left:2px    
        }
/*
        .paging:after{
            content:"";
            clear: both
        }
*/
        .paging li{
            display:inline-block
        }
        .paging a{
            padding:5px 10px;
            border: 1px solid #ddd;
            margin-left: -1px;
            text-decoration: none;
        }
        .active{
            border-color: #337ab7 !important;
        }
    </style>
</head>

<body>
    <div style="padding:10px;border-bottom:1px solid #eee;font-size:15px;font-weight:700">文章管理&nbsp;&nbsp;[<a href="addArticle.html">添加</a>]</div>
    <div style="padding:20px">
        <div style="margin-top:15px">
            <table class="table table-bordered table-hover">
              <thead>
                <tr>
                  <th>ID</th>
				  <th>标题</th>
                  <th>封面</th>
				  <th>添加时间</th>
                  <th>排序</th>
                  <th class="col-md-2">操作</th>
                </tr>
              </thead>
              <tbody>
			{loop $res as $r}
                <tr>
                  <td scope="row">{$r->id}</td>
				  <td>{$r->title}</td>
                  <td> <img src="{$r->pic}" style=" width: 100px; height: 25px;" /></td>
				  <td>{$r->ctime}</td>
                  <td>{$r->sort}</td>
                  <td>
                      <a class="btn btn-primary btn-sm" href="addArticle-{$r->id}.html">编辑</a>
					  <a class="btn btn-primary btn-sm" href="javascript::void(0)" onclick="del({$r->id})">删除</a>
                  </td>
                </tr>
			{/loop}
              </tbody>
            </table>
        </div>
        <div>
            <div style="display: inline-block">
                <span>{$p->totalnum}条/{$p->totalpage}页</span> 
            </div>
			<ul class="paging">
           {P weidogsadmin}
			</ul>
        </div>
    </div>
</body>
</html>
<script type="text/javascript">
function del(id){
	if(confirm('确定删除吗？')){
			ajax('delArticle.html',{ id:id},function(data){
				if(data == 'ok'){
					tusi('操作成功');
					setTimeout(function(){
						goto(location.href);
					},500);
				}
			});	
		}
}
</script>